/*
 * @ClassName VerifyCodeService
 * @Description 
 * @version 1.0
 * @Date 2024-06-17 15:33:37
 */
package com.taoge.biz.persistent.service;

import com.taoge.biz.common.enums.SmsActionType;
import com.taoge.biz.persistent.dao.VerifyCodeMapper;
import com.taoge.biz.persistent.entity.VerifyCode;
import com.taoge.framework.service.BaseService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

/**
 * @title: VerifyCodeService
 * @description: 验证码
 * @date:   2024-07-01 10:28:26
 * @author: YaoSiCheng
 * @param:  null
 * @return: null
 */
@Service
public class VerifyCodeService extends BaseService<VerifyCode ,VerifyCodeMapper> {

    /**
     * @title: selectValidCode
     * @description: 查询等待验证code
     * @date:   2024-07-01 10:38:09
     * @author: YaoSiCheng
     * @param:  userId
     * @param:  mobile
     * @param:  actionType
     * @return: VerifyCode
     */
    public VerifyCode selectValidCode(Long userId, String mobile, SmsActionType actionType) {
        return getMapper().selectValidCode(userId, mobile, actionType.name());
    }

    /**
     * @title: updateExpireCode
     * @description: 更新失效code
     * @date:   2024-07-01 10:38:09
     * @author: YaoSiCheng
     * @param:  userId
     * @param:  mobile
     * @param:  actionType
     * @return: int
     */
    public int updateExpireCode(Long userId,String mobile, SmsActionType actionType){
        return getMapper().updateExpireCode(userId, mobile, actionType.name());
    }

}